<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .outer{
            border:1px solid blue;
        }
        .inner{
            width: 400px;
            height: 200px;
            background-color: red;
        }
    </style>
</head>
<body>
    <!-- 浮动元素导致父元素高度塌陷 -->
    <button onclick="inner.style.float='left'">inner浮动</button>
    <div class="outer">
        <div class="inner" id="inner"></div>
    </div>
</body>
</html>